﻿// -----------------------------------------------------------------------
// Copyright (c) David Kean. All rights reserved.
// -----------------------------------------------------------------------
extern alias pcl;
using System;
using System.Text;
using System.Threading;
using Moq;
using Moq.Protected;

using IProtectedData = pcl::System.Security.Cryptography.Adaptation.IProtectedData;

namespace Portable
{
    internal class IProtectedDataMockFactory
    {
        public static IProtectedData OverrideProtect(Func<byte[], byte[], byte[]> action)
        {
            var mock = new Mock<IProtectedData>();
            mock.Setup(a => a.Protect(It.IsAny<byte[]>(), It.IsAny<byte[]>()))
                             .Returns(action);

            return mock.Object;
        }

        public static IProtectedData OverrideUnprotect(Func<byte[], byte[], byte[]> action)
        {
            var mock = new Mock<IProtectedData>();
            mock.Setup(a => a.Unprotect(It.IsAny<byte[]>(), It.IsAny<byte[]>()))
                             .Returns(action);

            return mock.Object;
        }
    }
}
